package com.ruoyi.technician.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.technician.domain.TechnicianZfbCount;
import com.ruoyi.technician.service.ITechnicianZfbCountService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 技师支付宝账户Controller
 * 
 * @author ruoyi
 * @date 2025-04-17
 */
@RestController
@RequestMapping("/technicianZfbCount/technicianZfbCount")
public class TechnicianZfbCountController extends BaseController
{
    @Autowired
    private ITechnicianZfbCountService technicianZfbCountService;

    /**
     * 查询技师支付宝账户列表
     */
    @PreAuthorize("@ss.hasPermi('technicianZfbCount:technicianZfbCount:list')")
    @GetMapping("/list")
    public TableDataInfo list(TechnicianZfbCount technicianZfbCount)
    {
        startPage();
        List<TechnicianZfbCount> list = technicianZfbCountService.selectTechnicianZfbCountList(technicianZfbCount);
        return getDataTable(list);
    }

    /**
     * 导出技师支付宝账户列表
     */
    @PreAuthorize("@ss.hasPermi('technicianZfbCount:technicianZfbCount:export')")
    @Log(title = "技师支付宝账户", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TechnicianZfbCount technicianZfbCount)
    {
        List<TechnicianZfbCount> list = technicianZfbCountService.selectTechnicianZfbCountList(technicianZfbCount);
        ExcelUtil<TechnicianZfbCount> util = new ExcelUtil<TechnicianZfbCount>(TechnicianZfbCount.class);
        util.exportExcel(response, list, "技师支付宝账户数据");
    }

    /**
     * 获取技师支付宝账户详细信息
     */
    @PreAuthorize("@ss.hasPermi('technicianZfbCount:technicianZfbCount:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(technicianZfbCountService.selectTechnicianZfbCountById(id));
    }

    /**
     * 新增技师支付宝账户
     */
    @PreAuthorize("@ss.hasPermi('technicianZfbCount:technicianZfbCount:add')")
    @Log(title = "技师支付宝账户", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TechnicianZfbCount technicianZfbCount)
    {
        return toAjax(technicianZfbCountService.insertTechnicianZfbCount(technicianZfbCount));
    }

    /**
     * 修改技师支付宝账户
     */
    @PreAuthorize("@ss.hasPermi('technicianZfbCount:technicianZfbCount:edit')")
    @Log(title = "技师支付宝账户", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TechnicianZfbCount technicianZfbCount)
    {
        return toAjax(technicianZfbCountService.updateTechnicianZfbCount(technicianZfbCount));
    }

    /**
     * 删除技师支付宝账户
     */
    @PreAuthorize("@ss.hasPermi('technicianZfbCount:technicianZfbCount:remove')")
    @Log(title = "技师支付宝账户", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(technicianZfbCountService.deleteTechnicianZfbCountByIds(ids));
    }
}
